class Group < ActiveRecord::Base
  belongs_to :evaluation_type
  belongs_to :subject
  belongs_to :academic_term
  belongs_to :group_type

  has_many :student_enrollments
  has_many :group_schedules
  has_many :schedules, :through => :group_schedules
  has_many :group_spaces
  has_many :academic_spaces, :through => :group_spaces
  has_many :group_teachers
  has_many :teachers, :through => :group_teachers
  has_many :group_grade_certificates

  validates_presence_of :capacity, :evaluation_type_id, :allow_overflow, :code, :academic_term_id, :group_type_id, :subject_id
  validates_uniqueness_of :code
  validates_numericality_of :capacity, :only_integer => true, :greater_than => 0
  
end
